# auto_test.py
# 模拟功能自动化测试并打印测试结果
from system_code import authenticate_user, get_user_menus

def simulate_login(username, password):
    print(f"测试用户登录: {username}")
    perm = authenticate_user(username, password)
    if perm:
        print(f"登录成功，权限码: {perm}")
        menus = get_user_menus(perm)
        print("可访问菜单:")
        for menu in menus:
            print(f" - {menu['name']}")
    else:
        print("登录失败：无效的用户名或密码或无权限")
    print("-" * 40)

if __name__ == '__main__':
    simulate_login("user001", "pw001")
    simulate_login("user002", "pw002")
    simulate_login("user003", "pw003")  # 无权限
    simulate_login("user001", "wrong")  # 密码错误
